$(function () {
    $("body").on('ifClicked','input[name=accountType]',function (event) {//提现账户类型
        var accountType = $(this).val();
        if(accountType==1){
            $(".zfb-box").removeClass('hide');
        }else if(accountType==2){
            $(".zfb-box").addClass('hide');
        }
    }).on('click','#cash-withdrawal-btn',function () {//确认提现申请
        var accountType = $('input[name=accountType]:checked').val();
        var teacherId = $("#teacherId").val();
        var recordType = $("#recordType").val();
        var realName = $("#realName").val();
        if(accountType ==2){//微信
            if(realName==null ||$.trim(realName)==''){
                icModale(0,'请填写提现账户真实姓名');
                return;
            }
            window.location.href = baseloaction +'/admin/qa/cash/getWeiXinCode?teacherId='+teacherId+"&recordType="+recordType+"&realName="+encodeURIComponent(realName);
        }else if(accountType==1) {//支付宝
            var account = $("#account").val();
            $.ajax({
                url:baseloaction +'/admin/qa/cash/zfbCashWithdrawal',
                type:'post',
                dataType:'json',
                data:{
                    'teacherId':teacherId,
                    'account':account,
                    'realName':realName,
                    'recordType':recordType
                },
                success:function (result) {
                    icModale(0,result.message);
                    if(result.success==true){
                        window.close();
                    }
                },
                error:function (error) {
                    icModale(0,'系统错误，操作失败');
                }
            });
        }
    }).on('click','#cancel-btn',function () {//取消
        window.close();
    });
});